// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.commands;

public final class PlayerType {
    public static final byte deprecated = 0;
    public static final byte fromServerOnly = 0;
    public static final byte player = 1;
    public static final byte observer = 2;
    public static final byte gm = 4;
    public static final byte overseer = 8;
    public static final byte moderator = 16;
    public static final byte admin = 32;
    public static final byte all = 63;
    public static final byte allExceptPlayer = 62;

    private PlayerType() {
    }

    public static String toString(byte _byte) {
        switch (_byte) {
            case 0:
                return "from-server-only";
            case 1:
                return "";
            case 2:
                return "observer";
            case 4:
                return "gm";
            case 8:
                return "overseer";
            case 16:
                return "moderator";
            case 32:
                return "admin";
            default:
                return "";
        }
    }

    public static byte fromString(String type) {
        type = type.trim().toLowerCase();
        if ("".equals(type) || "player".equals(type) || "none".equals(type)) {
            return 1;
        } else if ("observer".equals(type)) {
            return 2;
        } else if ("gm".equals(type)) {
            return 4;
        } else if ("overseer".equals(type)) {
            return 8;
        } else if ("moderator".equals(type)) {
            return 16;
        } else {
            return (byte)("admin".equals(type) ? 32 : 0);
        }
    }

    public static boolean isPrivileged(byte accessLevel) {
        return (accessLevel & 62) != 0;
    }
}
